package com.lsq.baseadmin;


import com.lsq.baseadmin.common.constant.ConstantSystem;
import com.lsq.baseadmin.modules.manage.vo.UserVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

/**
 * <p>
 * 系统用户 前端控制器
 * </p>
 *
 * @author lsq
 * @since 2020-10-22
 */
@Controller
public class MainController {

    @GetMapping("/")
    public String index(HttpSession session){
        UserVo user = (UserVo)session.getAttribute(ConstantSystem.SESSION_LOGIN_USER);
        if (null == user) {
            return "redirect:/login.html";
        }
        return "redirect:/index.html";
    }

    /**
     *  统一转页面， url参数为页面地址；例：去到user 的test页面；/toPage?url=/user/test；现不用
     * @param url 页面地址
     * @return 页面
     */
    @GetMapping("/toPage")
    public String toPage(String url){

        return url;
    }

}
